from rediscluster import StrictRedisCluster


class RedisDemo:
    startup_nodes = [
        {'host': '192.168.79.93', 'port': '3000'},
        {'host': '192.168.79.93', 'port': '3001'},
        {'host': '192.168.79.93', 'port': '3002'}
    ]

    def run(self):
        """
        rd = RedisDemo()
        rd.run()
        """
        rc = StrictRedisCluster(startup_nodes=self.startup_nodes, decode_responses=True)
        rc.set('name', 'lizhen')
        print(rc.get('name'))


if __name__ == '__main__':
    rd = RedisDemo()
    rd.run()
